package com.lvyerose.provinceandcity.provinceandcity.activity;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.widget.ListView;
import android.widget.Toast;

import com.lvyerose.provinceandcity.provinceandcity.R;
import com.lvyerose.provinceandcity.provinceandcity.adapter.ControlAdapter;

import java.util.List;


public class MainActivity extends ActionBarActivity {
    private ListView cityView;
    private ListView letterView;

    String[] cityLetter={"N","C","B","H","G","W","C","S","S","C","W","H","Z","C","D","N","L","Q","S","S"
            ,"L","N","H","X","H","S","Z","G","N","J","T","S","X","A"};
    String[] cityName={"宁乡","长沙","北京","杭州","广州","武汉","重庆","上海","深圳","长春","乌鲁木齐","哈尔滨","郑州","成都","大连","南昌","兰州","齐齐哈尔","汕头","苏州"
            ,"拉萨","南京","呼和浩特","厦门","合肥","沈阳","张家界","贵州","宁夏","济南","天津","石家庄","西安","澳门"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        cityView = ((ListView) findViewById(R.id.listView1));
        letterView = ((ListView) findViewById(R.id.listView2));
        new ControlAdapter(this, letterView, cityView, cityLetter, cityName, new ControlAdapter.OnItemCityClickListener() {
            @Override
            public void clickResult(List<String> citys, int position) {
                Toast.makeText(MainActivity.this, citys.get(position), Toast.LENGTH_SHORT).show();
            }
        });
    }




}
